﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraControl : MonoBehaviour
{
    public Transform Player;
    private float xoffset;
    private float yoffset;
    private float zoffset;

    // Start is called before the first frame update
    void Start()
    {
        xoffset = transform.position.x - Player.position.x;
        yoffset = transform.position.y - Player.position.y;
        zoffset = transform.position.z - Player.position.z;
    }

    // Update is called once per frame
    void Update()
    {
        CameraMove();
    }

    void CameraMove()
    {
        transform.position= new Vector3(Player.position.x + xoffset, Player.position.y + yoffset, transform.position.z);
    }

}
